vue-devui 1.6.21 → 1.6.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/code-review/index.es.js +26 -12
- package/code-review/index.umd.js +20 -20
- package/editor-md/index.es.js +5 -9
- package/editor-md/index.umd.js +19 -23
- package/package.json +1 -1
- package/types/code-review/src/code-review-types.d.ts +4 -0
- package/types/code-review/src/composables/use-code-review-comment.d.ts +1 -0
- package/types/code-review/src/composables/use-code-review-expand.d.ts +1 -1
- package/types/code-review/src/utils.d.ts +1 -1
- package/types/editor-md/src/icons-config.d.ts +1 -1
- package/vue-devui.es.js +32 -22
- package/vue-devui.umd.js +44 -48
package/code-review/index.es.js
CHANGED
|
@@ -6284,6 +6284,10 @@ const codeReviewProps = {
|
|
|
6284
6284
|
},
|
|
6285
6285
|
expandLoader: {
|
|
6286
6286
|
type: Function
|
|
6287
|
+
},
|
|
6288
|
+
options: {
|
|
6289
|
+
type: Object,
|
|
6290
|
+
default: () => ({})
|
|
6287
6291
|
}
|
|
6288
6292
|
};
|
|
6289
6293
|
const CodeReviewInjectionKey = Symbol("d-code-review");
|
|
@@ -6528,14 +6532,15 @@ function addClassToDiffCode(codeStrArr, theClassName) {
|
|
|
6528
6532
|
});
|
|
6529
6533
|
return newArray;
|
|
6530
6534
|
}
|
|
6531
|
-
function parseDiffCode(container, code, outputFormat, isAddCode = false) {
|
|
6535
|
+
function parseDiffCode(container, code, outputFormat, options, isAddCode = false) {
|
|
6532
6536
|
var _a;
|
|
6533
6537
|
const diff2HtmlUi = new Diff2HtmlUI(container, code, {
|
|
6534
6538
|
drawFileList: false,
|
|
6535
6539
|
matching: "lines",
|
|
6536
6540
|
outputFormat,
|
|
6537
6541
|
highlight: true,
|
|
6538
|
-
rawTemplates: TemplateMap[outputFormat]
|
|
6542
|
+
rawTemplates: TemplateMap[outputFormat],
|
|
6543
|
+
...options
|
|
6539
6544
|
});
|
|
6540
6545
|
if (outputFormat === "side-by-side") {
|
|
6541
6546
|
let diffHtmlStr = diff2HtmlUi.diffHtml;
|
|
@@ -6840,7 +6845,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6840
6845
|
}
|
|
6841
6846
|
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
6842
6847
|
};
|
|
6843
|
-
const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom) => {
|
|
6848
|
+
const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom, options) => {
|
|
6844
6849
|
if (!referenceDom) {
|
|
6845
6850
|
return;
|
|
6846
6851
|
}
|
|
@@ -6849,7 +6854,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6849
6854
|
}
|
|
6850
6855
|
const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
|
|
6851
6856
|
const container = document.createElement("div");
|
|
6852
|
-
parseDiffCode(container, prefix + code, outputFormat.value, true);
|
|
6857
|
+
parseDiffCode(container, prefix + code, outputFormat.value, options, true);
|
|
6853
6858
|
const trNodes = Array.from(container.querySelectorAll("tr"));
|
|
6854
6859
|
const expandLine = trNodes.find((element) => {
|
|
6855
6860
|
var _a;
|
|
@@ -6923,7 +6928,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6923
6928
|
}
|
|
6924
6929
|
attachExpandUpDownButton(loadMoreLine.children[0], "down");
|
|
6925
6930
|
};
|
|
6926
|
-
const insertIncrementCode = (code, direction, referenceDom) => {
|
|
6931
|
+
const insertIncrementCode = (code, direction, referenceDom, options) => {
|
|
6927
6932
|
if (!referenceDom) {
|
|
6928
6933
|
return;
|
|
6929
6934
|
}
|
|
@@ -6932,7 +6937,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6932
6937
|
}
|
|
6933
6938
|
const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
|
|
6934
6939
|
const container = document.createElement("div");
|
|
6935
|
-
parseDiffCode(container, prefix + code, outputFormat.value, true);
|
|
6940
|
+
parseDiffCode(container, prefix + code, outputFormat.value, options, true);
|
|
6936
6941
|
const trNodes = Array.from(container.querySelectorAll("tr"));
|
|
6937
6942
|
const expandLine = trNodes.find((element) => {
|
|
6938
6943
|
var _a;
|
|
@@ -6962,7 +6967,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6962
6967
|
}
|
|
6963
6968
|
}
|
|
6964
6969
|
};
|
|
6965
|
-
const onExpandButtonClick = (e) => {
|
|
6970
|
+
const onExpandButtonClick = (e, options) => {
|
|
6966
6971
|
var _a, _b;
|
|
6967
6972
|
const composedPath = e.composedPath();
|
|
6968
6973
|
const expandIconDom = composedPath.find((element) => {
|
|
@@ -6975,7 +6980,7 @@ function useCodeReviewExpand(reviewContentRef, props) {
|
|
|
6975
6980
|
const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFromDataset(expandIconDom, expandThreshold.value);
|
|
6976
6981
|
(_b = expandLoader == null ? void 0 : expandLoader.value) == null ? void 0 : _b.call(expandLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
|
|
6977
6982
|
var _a2, _b2;
|
|
6978
|
-
outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement);
|
|
6983
|
+
outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement, options) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement, options);
|
|
6979
6984
|
});
|
|
6980
6985
|
}
|
|
6981
6986
|
};
|
|
@@ -6994,14 +6999,14 @@ function useCodeReview(props, ctx) {
|
|
|
6994
6999
|
diffFile.value = Diff2Html.parse(diff.value);
|
|
6995
7000
|
nextTick(() => {
|
|
6996
7001
|
if (inBrowser && !showBlob.value) {
|
|
6997
|
-
parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
|
|
7002
|
+
parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value, props.options);
|
|
6998
7003
|
allowExpand.value && insertExpandButton();
|
|
6999
7004
|
ctx.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
|
|
7000
7005
|
}
|
|
7001
7006
|
});
|
|
7002
7007
|
};
|
|
7003
7008
|
const onContentClick = (e) => {
|
|
7004
|
-
onExpandButtonClick(e);
|
|
7009
|
+
onExpandButtonClick(e, props.options);
|
|
7005
7010
|
};
|
|
7006
7011
|
watch(showBlob, initDiffContent);
|
|
7007
7012
|
watch(outputFormat, initDiffContent);
|
|
@@ -7319,6 +7324,12 @@ function useCodeReviewComment(reviewContentRef, props, ctx) {
|
|
|
7319
7324
|
}
|
|
7320
7325
|
}
|
|
7321
7326
|
};
|
|
7327
|
+
const clearCheckedLines = () => {
|
|
7328
|
+
currentLeftLineNumbers = [];
|
|
7329
|
+
currentRightLineNumbers = [];
|
|
7330
|
+
checkedLineCodeString = [];
|
|
7331
|
+
resetCommentClass();
|
|
7332
|
+
};
|
|
7322
7333
|
const mouseEvent = allowComment.value ? { onMousemove: onMouseMove, onMouseleave } : {};
|
|
7323
7334
|
window.addEventListener("scroll", resetLeftTop);
|
|
7324
7335
|
onUnmounted(() => {
|
|
@@ -7329,6 +7340,7 @@ function useCodeReviewComment(reviewContentRef, props, ctx) {
|
|
|
7329
7340
|
commentTop,
|
|
7330
7341
|
mouseEvent,
|
|
7331
7342
|
updateCheckedLineClass,
|
|
7343
|
+
clearCheckedLines,
|
|
7332
7344
|
onCommentMouseLeave,
|
|
7333
7345
|
onCommentIconClick,
|
|
7334
7346
|
onCommentKeyDown,
|
|
@@ -7367,14 +7379,16 @@ var CodeReview = defineComponent({
|
|
|
7367
7379
|
unCommentKeyDown,
|
|
7368
7380
|
insertComment,
|
|
7369
7381
|
removeComment,
|
|
7370
|
-
updateCheckedLineClass
|
|
7382
|
+
updateCheckedLineClass,
|
|
7383
|
+
clearCheckedLines
|
|
7371
7384
|
} = useCodeReviewComment(reviewContentRef, props, ctx);
|
|
7372
7385
|
onMounted(() => {
|
|
7373
7386
|
ctx.emit("afterViewInit", {
|
|
7374
7387
|
toggleFold,
|
|
7375
7388
|
insertComment,
|
|
7376
7389
|
removeComment,
|
|
7377
|
-
updateCheckedLineClass
|
|
7390
|
+
updateCheckedLineClass,
|
|
7391
|
+
clearCheckedLines
|
|
7378
7392
|
});
|
|
7379
7393
|
onCommentKeyDown();
|
|
7380
7394
|
});
|